#include "numberkeyboard.h"
#include "ui_numberkeyboard.h"

#include "common/common.h"



NumberKeyboard::NumberKeyboard(int maxLen,int desc,QWidget *parent):
    TDialog(parent),
    ui(new Ui::NumberKeyboard)
{
    ui->setupUi(this);
    this->setGeometry(WINDOW_GEOMETRY_SHIFT(0.6,0.8,0.1));//WINDOW_GEOMETRY(0.6,0.8)
    ui->inputKey->setMaxLenth(maxLen);
    ui->inputKey->setDeci(desc);
    ui->inputKey->setEditor(ui->lineEdit);
    ui->inputKey->setFlashEnable(0);
    setAttribute(Qt::WA_DeleteOnClose);
    setWindowFlags(this->windowFlags()&(~Qt::FramelessWindowHint));
    connect(ui->inputKey,SIGNAL(quitReslut(bool)),this,SLOT(retReslut(bool)));
    setModal(false);
}

NumberKeyboard::~NumberKeyboard()
{
    delete ui;
}

void NumberKeyboard::retReslut(bool ret)
{
    if(ret)
    {
        this->hide();
        this->repaint();
        this->quitWithText(ui->lineEdit->text());
    }
    else
    {
        //this->quitWithText("");
    }
    this->close();
}
